package com.mdd.maduoduo.domain.interactor;

import android.util.Log;

import io.reactivex.observers.DisposableObserver;

/**
 * Default {@link DisposableObserver} base class to be used whenever you want default error handling.
 */
public abstract class BaseObserver<T> extends DisposableObserver<T> {
    @Override
    public void onNext(T t) {
        // no-op by default.
    }

    @Override
    public void onComplete() {
        // no-op by default.
    }

    @Override
    public final void onError(Throwable exception) {
        Log.e("httpError", exception.getMessage());
        onError(0, exception.getMessage());
    }

    public void onError(int code, String message) {
    }
}
